home *** CD-ROM | disk | FTP | other *** search
- /******************************************************************************************
- IsPCExchangeInstalled.c
-
- Written by Jim Luther with some modifications by Virginia McCulloh
- Apple Developer Technical Support
- August, 1996, Cupertino, CA
- Copyright 1996, Apple Computer, Inc.
-
- This snippet demonstrates the check for the existence of PC Exchange.
- The FSMGlueLib.o file is available on the MacOS SDK CD in the File
- System Manager Libraries folder.
-
- This runs under Metrowerks CodeWarrior 8 with the Universal
- Interfaces 2.1 from ETO #18.
-
- /*****************************************************************************/
-
- #include <Gestalt.h>
- #include <FSM.h>
-
- static Boolean HasFSM(void);
- Boolean IsMacPCExchangeInstalled(void);
-
-
- /*
- ** HasFSM determines if the File System Manager is available.
- */
- static Boolean HasFSM(void)
- {
- long response;
- Boolean result;
-
- result = false;
-
- /* Make sure the File System Manager is installed */
- if ( Gestalt(gestaltFSAttr, &response) == noErr )
- {
- if ( (response & (1L << gestaltHasFileSystemManager)) != 0 )
- {
- result = true;
- }
- }
-
- return ( result );
- }
-
- /*****************************************************************************/
-
- /*
- ** IsMacPCExchangeInstalled determines if Macintosh PC Exchange has installed
- ** the MS-DOS foreign file system.
- */
- Boolean IsMacPCExchangeInstalled(void)
- {
- enum
- {
- kMacPCExchangeFSID = 0x4953 /* file system ID of Macintosh PC Exchange's
- MS-DOS file system */
- };
- Boolean result;
- short bufSize; /* The size of the FSDRec */
- FSDRec theFSDRec; /* The FSDRec */
-
- result = false; /* default to no Macintosh PC Exchange */
-
- /* Make sure the File System Manager is available */
- if ( HasFSM() )
- {
- bufSize = sizeof(FSDRec);
- if ( GetFSInfo(fsmGetFSInfoByFSID, kMacPCExchangeFSID, &bufSize, &theFSDRec) == noErr )
- {
- result = true;
- }
- }
-
- return ( result );
- }
-
- /*****************************************************************************/
-
- /* Test code */
- void main(void)
- {
- if ( IsMacPCExchangeInstalled() )
- {
- DebugStr("\pMacintosh PC Exchange is installed");
- }
- else
- {
- DebugStr("\pMacintosh PC Exchange is NOT installed");
- }
- }